From 24116e31a5a2ed3b1dc989c9f9c841f1fc9161d6 Mon Sep 17 00:00:00 2001 From: "kaf24@labyrinth.cl.cam.ac.uk" Date: Mon, 10 Feb 2003 13:28:26 +0000 Subject: [PATCH] bitkeeper revision 1.22.2.13 (3e47a8faCADIagB6c2I4F2E1dGdRyw) processor.h, traps.c, smpboot.c, process.c: Fix bug in fast-trap handling. --- xen-2.4.16/arch/i386/process.c | 4 +--- xen-2.4.16/arch/i386/smpboot.c | 2 ++ xen-2.4.16/arch/i386/traps.c | 5 +---- xen-2.4.16/include/asm-i386/processor.h | 8 +++++++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/xen-2.4.16/arch/i386/process.c b/xen-2.4.16/arch/i386/process.c index 9eecfef2f5..a23f4b1557 100644 --- a/xen-2.4.16/arch/i386/process.c +++ b/xen-2.4.16/arch/i386/process.c @@ -326,9 +326,7 @@ void new_thread(struct task_struct *p, regs->eflags |= X86_EFLAGS_IF; /* No fast trap at start of day. */ - p->thread.fast_trap_idx = 0x20; - p->thread.fast_trap_desc.a = 0; - p->thread.fast_trap_desc.b = 0; + SET_DEFAULT_FAST_TRAP(&p->thread); } diff --git a/xen-2.4.16/arch/i386/smpboot.c b/xen-2.4.16/arch/i386/smpboot.c index 0dfd123178..dd0f94bd13 100644 --- a/xen-2.4.16/arch/i386/smpboot.c +++ b/xen-2.4.16/arch/i386/smpboot.c @@ -685,6 +685,8 @@ static void __init do_boot_cpu (int apicid) idle->thread.esp = idle->thread.esp0 = (unsigned long)idle + THREAD_SIZE; idle->thread.eip = (unsigned long) start_secondary; + SET_DEFAULT_FAST_TRAP(&idle->thread); + /* start_eip had better be page-aligned! */ start_eip = setup_trampoline(); diff --git a/xen-2.4.16/arch/i386/traps.c b/xen-2.4.16/arch/i386/traps.c index 59f293c8f9..cdea19eaa6 100644 --- a/xen-2.4.16/arch/i386/traps.c +++ b/xen-2.4.16/arch/i386/traps.c @@ -580,10 +580,7 @@ long do_set_fast_trap(int idx) if ( idx == 0 ) { CLEAR_FAST_TRAP(¤t->thread); - memset(idt_table+current->thread.fast_trap_idx, 0, 8); - current->thread.fast_trap_idx = 0x20; - current->thread.fast_trap_desc.a = 0; - current->thread.fast_trap_desc.b = 0; + SET_DEFAULT_FAST_TRAP(¤t->thread); return 0; } diff --git a/xen-2.4.16/include/asm-i386/processor.h b/xen-2.4.16/include/asm-i386/processor.h index 02868d5b23..f7f949d82b 100644 --- a/xen-2.4.16/include/asm-i386/processor.h +++ b/xen-2.4.16/include/asm-i386/processor.h @@ -358,8 +358,14 @@ struct thread_struct { trap_info_t traps[256]; }; +#define SET_DEFAULT_FAST_TRAP(_p) \ + (_p)->fast_trap_idx = 0x20; \ + (_p)->fast_trap_desc.a = 0; \ + (_p)->fast_trap_desc.b = 0; + #define CLEAR_FAST_TRAP(_p) \ (memset(idt_table + (_p)->fast_trap_idx, 0, 8)) + #define SET_FAST_TRAP(_p) \ (memcpy(idt_table + (_p)->fast_trap_idx, &((_p)->fast_trap_desc), 8)) @@ -369,7 +375,7 @@ struct thread_struct { { [0 ... 7] = 0 }, /* debugging registers */ \ 0, 0, 0, \ { { 0, }, }, /* 387 state */ \ - 0, { 0, 0 }, \ + 0x20, { 0, 0 }, /* DEFAULT_FAST_TRAP */ \ { {0} } /* io permissions */ \ } -- 2.30.2